<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>

<%@ page import="javax.portlet.RenderRequest" %>
<%@ page import="javax.portlet.RenderResponse" %>
<%@ page import="javax.portlet.ActionResponse" %>
<%@ page import="javax.portlet.PortletPreferences" %>

<%@ page import="pl.edu.agh.portal.application.types.ProjectType" %>
<%@ page import="pl.edu.agh.portal.application.utils.PortletsUtils" %>

<%@ page session="false" %>

<portlet:defineObjects/>

<% 
	PortletPreferences preferences = renderRequest.getPreferences();
	String[] menuItems = preferences.getValues(PortletsUtils.USER_MENU_ITEMS, new String[0]);
	ProjectType[] projectItems = (ProjectType[])(renderRequest.getAttribute(PortletsUtils.USER_PROJECTS_KEY));
%>

<table width="100%">
	<tr>
		<td align="center">
			<h2>Lista projektow</h2>
		</td>
	</tr>
  	<tr>
    	<td>
	    	<form method="post" action="<portlet:actionURL/>">
				<table width="100%" border="1">
					<tr>
						<th><%= PortletsUtils.NUMBER %></th>
						<th><%= PortletsUtils.PROJECTS_NAME %></th>
					<tr>
					<% for (int i=0; i< projectItems.length; i++) { %>
						<tr>
							<td><%= i+1 %></td>
							<td><%= projectItems[i].getProjectName() %></td>
						</tr>
					<% } %>
				</table>
			</form>
		</td>
  	</tr>
</table>


